//
//  SKUDetailTakeinTbV.m
//  ZITHER
//
//  Created by weixin on 2018/8/17.
//  Copyright © 2018年 weixn. All rights reserved.
//

#import "SKUDetailTakeinTbV.h"
#import "SKU_DetailTakeinDefault_Cell_WX.h"
#import "SKUDetailReceiveVC.h"
#import "AcceptPriceListModel.h"
#import "SKU_DetailTakeinDefault_Cell_WX.h"
@implementation SKUDetailTakeinTbV

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.delegate = self;
        self.dataSource = self;
        self.separatorStyle = UITableViewCellSeparatorStyleNone;
        [self registerNib:[UINib nibWithNibName:@"SKU_DetailTakeinDefault_Cell_WX" bundle:nil] forCellReuseIdentifier:@"SKU_DetailTakeinDefault_Cell_WX"];
        self.arrM = [[NSMutableArray alloc]init];
        self.estimatedRowHeight = 1000;
        self.rowHeight = UITableViewAutomaticDimension;
        self.separatorStyle = UITableViewCellSeparatorStyleNone;
        self.showsHorizontalScrollIndicator = NO;
        self.showsVerticalScrollIndicator = NO;
    }
    return self;
}

-(void)setArrM:(NSMutableArray *)arrM{
    _arrM = arrM;
    [self reloadData];
}

#pragma MARK - 数据源
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.arrM.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *sectionCell = @"SKU_DetailTakeinDefault_Cell_WX";
    SKU_DetailTakeinDefault_Cell_WX *cell = [tableView dequeueReusableCellWithIdentifier:sectionCell];
    if (cell == nil) {
        cell = [[SKU_DetailTakeinDefault_Cell_WX alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:sectionCell];
    }
    cell.type = SKU_DetailTakeinDefault_Cell_TypeReceive;
    AcceptPriceListModel *model = self.arrM[indexPath.row];
//    cell.type = self.type;
//    if (model.cellHeight == 0) {
//        CGFloat textViewH = [NSString textHeight:model.sourceDesc font:15 width:cell.textView.frame.size.width];
//        CGFloat imageSH = 0;
//        if (model.fileList.count>0) {
//            imageSH = 100;
//        }
//
//        model.cellHeight = 280 + textViewH + imageSH;
//    }
//
    cell.model = model;
    
    cell.selectionStyle = UITableViewCellSeparatorStyleNone;
  
    return cell;
}


//-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
//{
//    AcceptPriceListModel *model = self.arrM[indexPath.row];
//
//    return model.cellHeight;
//}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
//    SKUDetailReceiveVC *vc = [[SKUDetailReceiveVC alloc]init];
//    [[self getNav] pushViewController:vc animated:YES];
    
}




@end
